import request from '@/utils/request'

// 查询版块管理列表
export function listSection(query) {
  return request({
    url: '/platform/section/list',
    method: 'get',
    params: query
  })
}

// 查询版块管理详细
export function getSection(id) {
  return request({
    url: '/platform/section/' + id,
    method: 'get'
  })
}

// 新增版块管理
export function addSection(data) {
  return request({
    url: '/platform/section',
    method: 'post',
    data: data
  })
}

// 修改版块管理
export function updateSection(data) {
  return request({
    url: '/platform/section',
    method: 'put',
    data: data
  })
}

// 删除版块管理
export function delSection(id) {
  return request({
    url: '/platform/section/' + id,
    method: 'delete'
  })
}

// 查询最大编号
export function findMaxSort(query) {
  return request({
    url: '/platform/section/findMaxSort',
    method: 'get',
    params: query
  })
}

// 校验版块编码是否存在
export function checkCodeUnique (id, code) {
  if (id === undefined) {
    id = ''
  }
  return request({
    url: '/platform/section/checkCodeUnique/' + code + '/' + id,
    method: 'get'
  })
}


// 导出版块管理
export function exportSection(query) {
  return request({
    url: '/platform/section/export',
    method: 'get',
    params: query
  })
}

// 获取初始化数据
export function getInitData(dictTypes) {
  return request({
    url: '/platform/section/getInitData/' + dictTypes,
    method: 'get'
  })
}
